package com.study.base.collection;

import java.util.*;

/**
 * Description:
 * User: 27010
 * DateTime: 2018/3/2 18:06
 */
public class OrderCollection {
    public static void main(String[] args) {
        Map<Integer, Integer> linkedHashMap = new LinkedHashMap<>();
        Map<Integer, Integer> treeMap = new TreeMap<>();

        Set<Integer> linkedHashSet = new LinkedHashSet<>();
        Set<Integer> treeSet = new TreeSet<>();
        for (int i = 10; i >= 0; i--) {
            linkedHashMap.put(i, i);
            treeMap.put(i, i);

            linkedHashSet.add(i);
            treeSet.add(i);
        }
        linkedHashMap.put(100, 100);
        treeMap.put(100, 100);

        linkedHashSet.add(100);
        treeSet.add(100);

        for (Integer key : linkedHashMap.keySet()) {
            System.out.print(key + " ");
        }
        System.out.println("");

        for (Integer key : treeMap.keySet()) {
            System.out.print(key + " ");
        }
        System.out.println("");
        for (Integer key : linkedHashSet) {
            System.out.print(key + " ");
        }
        System.out.println("");
        for (Integer key : treeSet) {
            System.out.print(key + " ");
        }
        System.out.println("");
    }
}
